<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>C2C平台</title>
    <script src="/js/jquery-1.3.2.min.js">
    </script>
    <script src="/js/login/init_login.js"></script>
    <link rel="icon" href="/img/page_icon.png"/>
    <link rel="stylesheet" href="/css/login_and_register/login_back.css"/>
    <link rel="stylesheet" href="/css/login_and_register/register_page.css"/>
    <link rel="stylesheet" href="/css/login_and_register/confirm_password.css"/>
    <link rel="stylesheet" href="/css/login_and_register/forget_password.css"/>
    <script type="application/x-javascript"> addEventListener("load", function () {
        setTimeout(hideURLbar, 0);
    }, false);

    function hideURLbar() {
        window.scrollTo(0, 1);
    }
    function checkSubmit() {
        var phone=$('#phone').val();
        var username=$('#username').val();
        var password=$('#password').val();
        if(phone.length==0||username.length==0||password.length==0){
            alert("手机号,用户名,密码不能为空");
            return false;
        }
        return true;
    }
    </script>
</head>
<body>
<!--顶级的content是用来充当3D旋转的容器-->
<div class=".stage">
    <div class="content">
        <!--登陆界面-->
        <div class="login">
            <div class="check_mark">
                <div class="left_mark">
                </div>
                <div class="right_mark">
                </div>
            </div>
            <form action="/zhuce/add" onsubmit="return checkSubmit()">
                <div class="login_form">
                <div class="get_vcode">
                    <div class="nickname_div">
                        <input class="input_nickname  placeholder" name="username" id="username" type="text" placeholder="用户名"/>
                    </div>
                    <div class="register_phone_div">

                        <input type="text" id="phone" name="phone" placeholder="请输入手机号" class="register_input_phone placeholder"/>
                    </div>
                    <div class="register_vcode_div">
                        <input type="password" name="password"  id="password" placeholder="请输入密码" class="register_input_vcode placeholder"/>

                    </div>
                    <button type="submit" class="go_enter_password_button">注册</button>
                </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="/static/jquery/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
    var id;//定制器的id,停止定时地需要
    var count = 60;//倒计时的时间,单位秒
    $(function () {
        $("#sendCode").click(function () {
            //获取手机号
            var phone = $("#phone").val();
            if (phone.length == 0) {
                alert("手机号不能为空!");
                return;
            }
            //禁用按钮
            $(this).attr("disabled", "disabled");
            //启动倒计时
            id = setInterval("time()", 1000);
            //发送ajax请求
            $.getJSON("/user/sendCode", {phone: phone}, function (result) {
                if (result.msg == "OK") {
                    alert("验证码已发送");
                } else {
                    alert(result.msg);
                }
            });
        });

        $("#btnLogin").click(function () {
            var code = $("#code").val();
            $.getJSON("/user/logins", {code: code}, function (result) {

                if (result.msg == "ok") {
                    location.href = "/phoneIndex";
                } else {
                    alert(result.msg);
                }
            })
        })
    });
/*    var count = 60;

    function time() {
        count--;
        if (count == 0) {
            $('#sendCode').removeAttr("disabled");
            count = 60;
            $('#sendCode').val("重新发送");
            //停止计时
            clearInterval(id);
        } else {
            $('#sendCode').val(count + 's后,重新发送');
        }
    }*/

</script>
</html>